#!/bin/bash
#arguments list
# arglist.sh

ERR_BADARGS=65

if [ ! -n "$1" ]
then
    echo "Usage: `basename $0` argument1 argument2 ..."
    exit $ERR_BADARGS
fi

index=1
echo "Listing args with \"\$*\":"

for arg in "$*"
do
    echo "Arg #$index = $arg"
    let "index+=1"
done
echo "Entire arg list seen as single word."

echo

index=1
echo "Listing args with \"\$@\":"
for arg in "$@"
do
    echo "Arg #$index = $arg"
    let "index+=1"
done
echo "Arg list seen separate words."

echo

index=1
echo "Listing args with \$* (unquoted):"
for arg in $*
do
    echo "Arg #$index = $arg"
    let "index+=1"
done
echo "Args list seen as separate words"

exit 0
